import { defineStore } from 'pinia'
import { getLocalStorage, setLocalStorage } from '@/utils/localData'

const useUserStore = defineStore('User', {
  state: () => {
    return {
      userDatas: getLocalStorage('user') || {},
      homeTheme: false,
      liziColor: '#00a4ff'
    }
  },

  actions: {

    // 个人名字或头像修改
    changeData(prop, data) {
      this.userDatas[prop] = data
      setLocalStorage('user', this.userDatas)
    },

    // home页主题
    homeThemeChange() {
      this.homeTheme = !this.homeTheme
    },

    // 粒子颜色
    liziColorChange(color) {
      this.liziColor = color
    }
  },

  getters: {

  }
})

export default useUserStore
